<?php
namespace app\index\controller;
use think\View;
use think\Db;
use think\Controller;
// use app\home\model\User;

class Register extends Controller{

  public function index(){
    $view = new View();
    return $view->fetch('index');

  }

  //用户注册
  public function regist(){
    //实例化User
    /*$user = new User;
    //接收前端表单提交的数据
    $user->username = input('post.username');
    $user->user_number = input('post.user_number');
    $user->password = input('post.password');
    */
    $data['username'] = input('post.username');
    $data['user_number'] = input('post.user_number');
    $data['password'] = input('post.password');
    Db::name('user')->insert($data);
    var_dump($data);
  

    //写入数据库
    // if ($user->save()) {
    //   return $this->success('注册成功');
    //   exit();
    // } else {
    //   return $this->success('注册失败');
    //   exit();
    // }


  }
}